#ifndef ITEM_H
#define ITEM_H
#include<QString>
#include<QDataStream>
//通讯录类，包含物品名称，标签，位置和数量
class items{
public:

    QString i_name; //设置名称
    QString tag;    //设置标签
    QString location; //设置位置
    items*next;
    int num;

   public:
    //统计链表节点数量
    static int TotalCount;
   items() {
        i_name = "";
        tag = "";
        location = "";
        next = nullptr;
        num = 0;
    }
     items(QString n,QString l,int num);
     items(QString n,QString l,int num,QString t);
     void setItem(QString n,QString l,int num,QString t);
     bool isEmpty();
     void setName(QString n);
     void setTag(QString n);
     void setLocation(QString n);
     void setNum(int n);
     QString getName ()const;
     QString getTag ()const;
     QString getLoc()const;
     int getNum()const;
     items getItem(){
         return*this;
     };

     friend class MainWindow;
    //重载输出流<<
    friend QDataStream& operator<<(QDataStream& out,const items& item){
        out<<item.getName()<<item.getLoc()<<item.getNum()<<item.getTag();
        return out;
    };
    friend QDataStream& operator>>(QDataStream& in,const items& item){
        int num;
        QString name; //设置名称
        QString tag;    //设置标签
        QString location; //设置位置
        in>>name>>location>>num>>tag;
        in<<item.getName()<<item.getLoc()<<item.getNum()<<item.getTag();
        return in;
    };
    items operator=(const items&a){
        this->num=a.getNum();
        this->i_name=a.getName();
        this->tag=a.getTag();
        this->location=a.getLoc();
        return*this;
    }


//    //显示
//    void showi();
};

#endif // ITEM_H
